package com.ruoyi.service.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.domain.ServiceOrderotherpay;
import com.ruoyi.service.service.IServiceOrderotherpayService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 其他费用Controller
 * 
 * @author ZDL
 * @date 2024-12-26
 */
@RestController
@RequestMapping("/service/orderotherpay")
public class ServiceOrderotherpayController extends BaseController
{
    @Autowired
    private IServiceOrderotherpayService serviceOrderotherpayService;

    /**
     * 查询其他费用列表
     */
    @PreAuthorize("@ss.hasPermi('service:orderotherpay:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServiceOrderotherpay serviceOrderotherpay)
    {
        startPage();
        List<ServiceOrderotherpay> list = serviceOrderotherpayService.selectServiceOrderotherpayList(serviceOrderotherpay);
        return getDataTable(list);
    }

    /**
     * 导出其他费用列表
     */
    @PreAuthorize("@ss.hasPermi('service:orderotherpay:export')")
    @Log(title = "其他费用", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ServiceOrderotherpay serviceOrderotherpay)
    {
        List<ServiceOrderotherpay> list = serviceOrderotherpayService.selectServiceOrderotherpayList(serviceOrderotherpay);
        ExcelUtil<ServiceOrderotherpay> util = new ExcelUtil<ServiceOrderotherpay>(ServiceOrderotherpay.class);
        util.exportExcel(response, list, "其他费用数据");
    }

    /**
     * 获取其他费用详细信息
     */
    @PreAuthorize("@ss.hasPermi('service:orderotherpay:query')")
    @GetMapping(value = "/{orderotherpayId}")
    public AjaxResult getInfo(@PathVariable("orderotherpayId") Long orderotherpayId)
    {
        return success(serviceOrderotherpayService.selectServiceOrderotherpayByOrderotherpayId(orderotherpayId));
    }

    /**
     * 新增其他费用
     */
    @PreAuthorize("@ss.hasPermi('service:orderotherpay:add')")
    @Log(title = "其他费用", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ServiceOrderotherpay serviceOrderotherpay)
    {
        return toAjax(serviceOrderotherpayService.insertServiceOrderotherpay(serviceOrderotherpay));
    }

    /**
     * 修改其他费用
     */
    @PreAuthorize("@ss.hasPermi('service:orderotherpay:edit')")
    @Log(title = "其他费用", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ServiceOrderotherpay serviceOrderotherpay)
    {
        return toAjax(serviceOrderotherpayService.updateServiceOrderotherpay(serviceOrderotherpay));
    }

    /**
     * 删除其他费用
     */
    @PreAuthorize("@ss.hasPermi('service:orderotherpay:remove')")
    @Log(title = "其他费用", businessType = BusinessType.DELETE)
	@DeleteMapping("/{orderotherpayIds}")
    public AjaxResult remove(@PathVariable Long[] orderotherpayIds)
    {
        return toAjax(serviceOrderotherpayService.deleteServiceOrderotherpayByOrderotherpayIds(orderotherpayIds));
    }
}
